package July;

import java.util.Scanner;
import java.util.Stack;

public class Day0711 {
    //倒序字符串
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String s = scanner.nextLine();
            //分割
            String[] str = s.split(" ");

            //栈先入后出  可以使用
            Stack<String> stack = new Stack<>();

            for (int i = 0; i < str.length; i++) {
                stack.push(str[i]);
            }

            while (!stack.isEmpty()){
                for (int i = 0; i < stack.size(); i++) {
                    StringBuffer stringBuffer = new StringBuffer();
                    stringBuffer.append(stack.pop() + " ");
                    System.out.println(stringBuffer);
                }
            }
        }
    }


    //排列子序列
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()){
            int n = scanner.nextInt();
            int[] num = new int[n];
            for (int i = 0; i < n; i++) {
                num[i] = scanner.nextInt();
            }


            //开始处理数据
            // 非递增  num[i] <= num[i+1]
            // 非递减  num[i] >= num[i+1]
            int f = 0;
            int count = 1;
            for (int i = 0; i < num.length-1; i++) {
                if (num[i] < num[i+1]){
                    if (f == 0){
                        f = 1;
                    }
                    if (f == -1){
                        f = 0;
                        count++;
                    }

                }else if (num[i] > num[i+1]){
                    if (f == 0){
                        f = -1;
                    }
                    if (f == 1){
                        f = 0;
                        count++;
                    }
                }
            }
            System.out.println(count);
        }
    }
}
